﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace LLTreeManagementApplication.InfoMessage
{
    enum MessageType
    {
        Info = 1,
        Error = 2,
    }

    class InfoMessageHandler
    {
        ListBox _lbx = null;
        bool _extendedLogging = false;
        public InfoMessageHandler(ListBox lbx, bool extendedLogging = false)
        {
            _extendedLogging = extendedLogging;
            _lbx = lbx;
        }

        public void PrintInfo(string text)
        {
            _lbx.Items.Add(text);
        }

        public void PrintError(string text)
        {
            _lbx.Items.Add(text);
        }

        public void ExtendedLogging(string text)
        {
            if (_extendedLogging) 
            {
                PrintInfo(string.Format("{0} {1}", text, DateTime.Now));
            }
        }

        public void Clear()
        {
            _lbx.Items.Clear();
        }
    }
}
